{% macro gen_table(products, current_user, kwargs) %}
    <table id="product-table"
           class="table table-bordered table-hover table-condensed table-striped">
        <thead>
        <tr>
            <th>序号</th>
            <th>产品类型</th>
            <th>标题</th>
            <th>品牌</th>
            <th>权重</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {% for product in products %}
            <tr>
                <td>{{ loop.index }}</td>
                <td>{{ product.product_type_name }}</td>
                <td>{{ product.title_display }}</td>
                <td>{{ product.brand }}</td>
                <td>{{ product.weight }}</td>
                <td>
                    <a
                            class="btn btn-group btn-xs btn-primary"
                            href="{{ url_for('product_bp.product_info', product_id=product.id) }}"
                            name="user-info"
                            target="_self"
                    >编辑</a>
                    {% if current_user.is_authenticated %}
                        <a
                                class="btn btn-group btn-xs btn-danger"
                                href="{{ url_for('product_bp.ajax_delete_product', product_id=product.id, **kwargs) }}"
                                onclick="if(confirm('确认删除') == false) return false;"
                                name="user-info"
                                target="_self"
                        >删除</a>
                    {% endif %}
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
{% endmacro %}
